package tnasonline

import (
	"github.com/spf13/afero"
	"gitlab.local/DO-module/new-filemanage-module/src/core/httpclient"
	"gitlab.local/DO-module/new-filemanage-module/src/core/servicectl"
	"gitlab.local/golibrary/sysconfig"
)

// exports
type Ctl interface {
	GetId() (string, error)
	IsEnabled() bool
	GetSelectedServer() (string, bool)
}

type Server struct {
	Name      []string `json:"name"`
	Recommend []string `json:"recommend"`
	Domain    string   `json:"domain"`
}

type TNasOnline struct {
	fs                    afero.Fs
	httpC                 httpclient.PostGet
	globalConfigGetSetter sysconfig.GetSetter
	appCtl                servicectl.Ctl
	DefaultDomain         int
}

func New(confGetSetter sysconfig.GetSetter, fs afero.Fs, appCtl servicectl.Ctl, httpC httpclient.PostGet) *TNasOnline {
	obj := &TNasOnline{
		fs:                    fs,
		httpC:                 httpC,
		appCtl:                appCtl,
		globalConfigGetSetter: confGetSetter,
		DefaultDomain:         -1,
	}

	return obj
}
